<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/10/27
 * Time: 10:16
 */

namespace zhtfrontend\modules\sitepadapi\controllers;

use common\components\helpers\Fun;
use zhtfrontend\modules\sitepadapi\components\rest\ActiveController;
use yii\data\ActiveDataProvider;

class CommentdepartController extends ActiveController
{
    public $modelClass = 'zhtfrontend\models\datas\Department';

    public $serializer = [
        'class' => 'zhtfrontend\modules\sitepadapi\components\rest\Serializer',
        'collectionEnvelope' => 'items',
    ];

    public function actions()
    {
        $actions = parent::actions();
        unset($actions['index'], $actions['create'], $actions['update'], $actions['delete'], $actions['view']);
        return $actions;
    }

    public function actionIndex()
    {
        $query=(new \yii\db\Query())->select('*')->from('{{%department}}');
        return new ActiveDataProvider([
            'db'=>Fun::getSiteDb(),
            'query' => $query
        ]);
    }

    public function actionCreate(){

    }

}